﻿Module mdlWinAPI
    ''' <summary>
    ''' 建立一个光标
    ''' </summary>
    ''' <param name="hWnd">控件的句柄</param>
    ''' <param name="SrcImage">位图的句柄（0的话，表示一个白色的光标，1的话，表示一个灰色的光标）</param>
    ''' <param name="ImageWidth">光标的宽度（0的话，使用系统的设定）</param>
    ''' <param name="ImageHeight">光标的高度（0的话，使用系统的设定）</param>
    ''' <returns>是否成功</returns>
    ''' <remarks></remarks>
    Declare Function CreateCaret Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal SrcImage As IntPtr, ByVal ImageWidth As Int32, ByVal ImageHeight As Int32) As Boolean
    ''' <summary>
    ''' 表示光标
    ''' </summary>
    ''' <param name="hWnd">控件的句柄</param>
    ''' <returns>是否成功</returns>
    ''' <remarks>必须要写在GetFocus里面，同时控件的SetStyle的Selectable为True</remarks>
    Declare Function ShowCaret Lib "user32.dll" (ByVal hWnd As IntPtr) As Boolean
    ''' <summary>
    ''' 设定光标的位置
    ''' </summary>
    ''' <param name="x">X位置</param>
    ''' <param name="y">Y位置</param>
    ''' <returns>是否成功</returns>
    ''' <remarks>HideCaret的逆操作</remarks>
    Declare Function SetCaretPos Lib "user32.dll" (ByVal x As Int32, ByVal y As Int32) As Boolean
    ''' <summary>
    ''' 隐藏光标
    ''' </summary>
    ''' <param name="hWnd">控件句柄</param>
    ''' <returns>是否成功</returns>
    ''' <remarks>ShowCaret的逆操作</remarks>
    Declare Function HideCaret Lib "user32.dll" (ByVal hWnd As IntPtr) As Boolean
    ''' <summary>
    ''' 销毁光标
    ''' </summary>
    ''' <returns>是否成功</returns>
    ''' <remarks>CreateCaret的逆操作</remarks>
    Declare Function DestroyCaret Lib "user32.dll" () As Boolean

    '系统消息 字符来自于IME
    Public Const WM_IME_CHAR As Integer = &H286
    '系统消息 字符来自于字符
    Public Const WM_CHAR As Integer = &H102
End Module
